package object;

/**
 * 成员方法练习
 */
public class MethodExercise01 {

    public static void main(String[] args) {

        /*
            1)编写类AA 有一个方法：判断一个数是奇数odd还是偶数，返回boolean
            2)根据行、列、字符打印 对应行数和列数的字符，如：行4，列4，字符#，则打印相应的效果
                ####
                ####
                ####
                ####
         */
        AAA aaa = new AAA();
        if (aaa.judge(2)) {
            System.out.println("是偶数");
        }else {
            System.out.println("是奇数");
        }

        aaa.print(4, 4, '#');
    }
}

class AAA {

    public boolean judge (int n) {
        return n % 2 == 0;
    }

    public void print(int row, int col, char c) {
        char[][] chars = new char[row][col];
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                chars[i][j] = c;
            }
        }
        System.out.println("====打印结果如下：====");
        for (char[] aChar : chars) {
            for (char aChar1 : aChar) {
                System.out.print(aChar1 + " ");
            }
            System.out.println();
        }
    }


}
